package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.Member;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface MemberMapper extends BaseMapper<Member> {
    @Select("select * from t_member where PHONENUMBER=#{telephone}")
    Member findMemeberBytelephone(@Param("telephone") String telephone);

    @Select("select count(1) from t_member where REGTIME = #{today}")
    int getTodayNewMember(@Param("today") String today);

    @Select("select count(1) from t_member where REGTIME between #{thisWeekMonday} and #{thisWeekSunday}")
    int getThisWeekNewMember(@Param("thisWeekMonday") String thisWeekMonday, @Param("thisWeekSunday") String thisWeekSunday);

    @Select("select count(1) from t_member")
    int gettotalMember();

    @Select("select count(1) from t_member where REGTIME between #{firstDayOfMonth} and #{lastDayOfMonth}")
    int getthisMonthNewMember(@Param("firstDayOfMonth") String firstDayOfMonth, @Param("lastDayOfMonth") String lastDayOfMonth);

}
